package com.bsfcs.rag.repository;

import com.bsfcs.rag.entity.Contract;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ContractRepository extends JpaRepository<Contract, String> {
    @Query("SELECT new com.bsfcs.rag.entity.Contract(w.id, w.project, w.cbxm_code, w.cbxm_name, w.code, w.name, " +
            "w.opposite_contract_code, w.contract_total_money, w.signing_time, w.begintime, w.endtime, w.jsfsname, w.kxytname, w.contract_biz_status, " +
            "w.cgfs_type, w.purchase_enabled, w.yj_income, w.yj_cost, w.yj_ml, w.gross_margin, w.net_profit_margin, w.yj_jl, w.jhtje, " +
            "w.client_name, w.khxz, w.szhy, w.scale, w.sf, w.city_proper, w.district_level, w.address, w.contracting_party_orgname, w.signatory_id," +
            "w.isauthorized, w.consortium_type, w.consortium_name, w.legal_representative, w.isconsortium ) FROM Contract w WHERE w.project = ?1")
    List<Contract> findByProjectId(String projectId);
}
